* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #e94560;
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
    margin-bottom: 10px;
}

.stats {
    display: flex;
    justify-content: space-around;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 5px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    aspect-ratio: 1/1;
}

.game-mode-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
}

.mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
    justify-content: center;
}

.mode-btn {
    background: rgba(233, 69, 96, 0.5);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn.active {
    background: #e94560;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.8);
}

.gem {
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, opacity 0.2s;
    position: relative;
    user-select: none;
}

.gem.rotator {
    outline: 3px dashed white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    z-index: 5;
}

.gem.rotating {
    animation: rotate 0.5s forwards;
}

.gem svg {
    width: 80%;
    height: 80%;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

.gem.selected {
    transform: scale(0.9);
    box-shadow: 0 0 15px white;
}

.gem.hint {
    animation: pulse 1s infinite alternate;
}

.gem.falling {
    transition: transform 0.3s ease-in;
}

.gem.matching {
    animation: match 0.5s forwards;
}

#combo-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ff6b6b, #e94560);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.8);
    animation: pulse 0.5s infinite alternate;
}

.controls {
    display: flex;
    justify-content: space-around;
}

button {
    background: #e94560;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:hover {
    background: #ff6b81;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid #e94560;
    max-width: 400px;
    width: 90%;
}

.modal h2 {
    color: #e94560;
    margin-bottom: 20px;
}

.modal p {
    margin-bottom: 25px;
    font-size: 1.2rem;
}

.power-up::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    box-shadow: 0 0 10px white, inset 0 0 15px white;
    z-index: 1;
    pointer-events: none;
}

.power-up.bomb::after {
    box-shadow: 0 0 10px red, inset 0 0 15px orange;
    animation: pulse-bomb 1.5s infinite alternate;
}

.power-up.star::after {
    box-shadow: 0 0 10px yellow, inset 0 0 15px gold;
    animation: pulse-star 1.5s infinite alternate;
}

.power-up.lightning::after {
    box-shadow: 0 0 10px cyan, inset 0 0 15px white;
    animation: pulse-lightning 1.5s infinite alternate;
}

.power-up.time::after {
    box-shadow: 0 0 10px green, inset 0 0 15px lightgreen;
    animation: pulse-time 1.5s infinite alternate;
}

.power-up-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.poker-hand {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.poker-target {
    text-align: center;
    font-size: 0.9rem;
}

.poker-gems {
    display: flex;
    gap: 5px;
}

.poker-gem {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.poker-gem svg {
    width: 80%;
    height: 80%;
}

.ice-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(173,216,230,0.7));
    border-top: 2px solid white;
    border-radius: 0 0 10px 10px;
    transition: height 0.5s;
    pointer-events: none;
    z-index: 10;
}

.ice-storm-container {
    position: relative;
}

.temperature-gauge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 80%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.temperature-level {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, blue, cyan, white);
    transition: height 0.5s;
}

.lightning-multiplier {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #9b59b6, #3498db);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 5px 15px;
    border-radius: 15px;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.8);
    animation: pulse 0.5s infinite alternate;
}

.power-up-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 2rem;
    font-weight: bold;
    padding: 20px 40px;
    border-radius: 10px;
    z-index: 1000;
    text-align: center;
    transition: transform 0.3s ease-out;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.8);
}

.power-up-message.show {
    transform: translate(-50%, -50%) scale(1);
}

#twist-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 10px;
}

.dirt-block {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #8B4513, #654321);
    border-radius: 10px;
    z-index: 5;
}

.diamond-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    z-index: 6;
    pointer-events: none;
}

.diamond-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.diamond-counter-icon {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 0 5px rgba(173, 216, 230, 0.8));
}

.depth-meter {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 20px;
    height: 80%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.depth-level {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, #8B4513, #ff9500);
    transition: height 0.5s;
}

.butterfly {
    position: absolute;
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    z-index: 10;
    animation: flutter 2s infinite alternate;
    pointer-events: none;
}

.spider {
    position: absolute;
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    z-index: 11;
    animation: bounce 1s infinite alternate;
    pointer-events: none;
}

.butterfly-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.butterfly-counter-icon {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 0 5px rgba(255, 192, 203, 0.8));
}

.spider-position {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 80%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.spider-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, darkred, red);
    transition: height 0.5s;
}

.bomb {
    position: absolute;
    width: 90%;
    height: 90%;
    top: 5%;
    left: 5%;
    z-index: 10;
    animation: pulse 0.5s infinite alternate;
    pointer-events: none;
}

.bomb-timer {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 50%;
    z-index: 11;
}

.bomb-timer.warning {
    color: red;
    animation: pulse 0.3s infinite alternate;
    background: rgba(0, 0, 0, 0.8);
}

.explosion {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, yellow, orange, red);
    border-radius: 50%;
    animation: explode 1s forwards;
    z-index: 20;
}

.bomb-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.bomb-counter-icon {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.8));
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes match {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(calc(90deg * var(--rotation-direction, 1)));
    }
}

@keyframes pulse-bomb {
    0% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 20px red, inset 0 0 25px orange;
    }
}

@keyframes pulse-star {
    0% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 20px yellow, inset 0 0 25px gold;
    }
}

@keyframes pulse-lightning {
    0% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 20px cyan, inset 0 0 25px white;
    }
}

@keyframes pulse-time {
    0% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 20px green, inset 0 0 25px lightgreen;
    }
}

@keyframes flutter {
    0% {
        transform: rotate(-5deg) translateY(0px);
    }
    100% {
        transform: rotate(5deg) translateY(-5px);
    }
}

@keyframes bounce {
    0% {
        transform: translateY(0px);
    }
    100% {
        transform: translateY(-3px);
    }
}

@keyframes explode {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.5);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

@media (max-width: 500px) {
    .game-container {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    .stats {
        font-size: 1rem;
    }

    .gem svg {
        width: 95%;
        height: 95%;
    }
    
    .mode-buttons {
        gap: 5px;
    }
    
    .mode-btn {
        padding: 3px 8px;
        font-size: 0.9rem;
    }
    
    .poker-gem {
        width: 25px;
        height: 25px;
    }
    
    .poker-target {
        font-size: 0.8rem;
    }
}